package session;

import cn.hutool.core.io.resource.ResourceUtil;
import org.apache.ibatis.session.SqlSession;
import top.lingkang.mm.transaction.TransactionManage;
import top.lingkang.mmt.entity.UserEntity;
import top.lingkang.mmt.mapper.UserMapper;
import utils.TestUtils;

/**
 * 多数据源测试
 * @author lingkang
 * @date 2025/5/16 10:31
 */
public class Test01 {
    public static void main(String[] args) {
        SqlSession h2 = TestUtils.getH2();
        SqlSession sqlite = TestUtils.getSqlite();
        UserMapper h2UserMapper = h2.getMapper(UserMapper.class);
        UserMapper sqliteUserMapper = sqlite.getMapper(UserMapper.class);

        UserEntity entity = new UserEntity();
        entity.setId(20250516L);
        TransactionManage.beginTransaction();
        int insert = h2UserMapper.insert(entity);
        TransactionManage.commit();


    }
}
